package com.dms.web.controller.system;

import java.util.List;

import com.dms.system.domain.SysOmission;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.dms.common.annotation.Log;
import com.dms.common.enums.BusinessType;
import com.dms.system.service.ISysOmissionService;
import com.dms.common.core.controller.BaseController;
import com.dms.common.core.domain.AjaxResult;
import com.dms.common.utils.poi.ExcelUtil;
import com.dms.common.core.page.TableDataInfo;

/**
 * 昨日漏检Controller
 * 
 * @author xlong_zhu
 * @date 2021-04-06
 */
@Controller
@RequestMapping("/system/omision")
public class SysOmissionController extends BaseController
{
    private String prefix = "system/omision";

    @Autowired
    private ISysOmissionService sysOmisionService;

    @RequiresPermissions("system:omision:view")
    @GetMapping()
    public String omision()
    {
        return prefix + "/omision";
    }

    /**
     * 查询昨日漏检列表
     */
    @RequiresPermissions("system:omision:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SysOmission sysOmission)
    {
        startPage();
        List<SysOmission> list = sysOmisionService.selectSysOmissionList(sysOmission);
        return getDataTable(list);
    }

    /**
     * 导出昨日漏检列表
     */
    @RequiresPermissions("system:omision:export")
    @Log(title = "昨日漏检", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SysOmission sysOmission)
    {
        List<SysOmission> list = sysOmisionService.selectSysOmissionList(sysOmission);
        ExcelUtil<SysOmission> util = new ExcelUtil<SysOmission>(SysOmission.class);
        return util.exportExcel(list, "omision");
    }

    /**
     * 删除昨日漏检
     */
    @RequiresPermissions("system:omision:remove")
    @Log(title = "昨日漏检", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(sysOmisionService.deleteSysOmissionByIds(ids));
    }
}
